updating oE warning

warning

<built-in> procedure warning(sequence message) 

causes the specified warning message to be displayed as a regular warning.

Parameters:
  1. message : a double quoted literal string, the text to display.
Comments:

Writing a library has specific requirements, since the code you write will be mainly used inside code you did not write. It may be desirable then to influence, from inside the library, that code you did not write.

This is what warning, in a limited way, does. It enables to generate custom warnings in code that will include yours. Of course, you can also generate warnings in your own code, for instance as a kind of memo. The without warning top level statement disables such warnings.

The warning is issued with the custom_warning level. This level is enabled by default, but can be turned off any time.

Using any kind of expression in message will result in a blank warning text.

Example 1:
-- mylib.e 
procedure foo(integer n) 
    warning("The foo() procedure is obsolete, use bar() instead.") 
    ? n 
end procedure 
 
-- some_app.exw 
include mylib.e 
foo(123) 

will result, when some_app.exw is run with warning, in the following text being displayed in the console (terminal) window

123 
Warning: ( custom_warning ): 
The foo() procedure is obsolete, use bar() instead. 
 
Press Enter... 

See Also:

warning_file without warning

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu